/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author chenjinlong
 */
public class GradientDescentTrainer implements TrainingAlgorithm {
    private final double learningRate;//学习率
    
    public GradientDescentTrainer(double learningRate) {
        this.learningRate = learningRate;
    }
    
    @Override
    public NeuralNetwork train(double[][] inputs, double[] targets, int iterations) {
        //创建梯度下降神经网络实例
        GradientDescentNN network = new GradientDescentNN(learningRate);
        //调用网络的训练方法进行实际训练
        network.train(inputs, targets, iterations);
        //返回训练好的网络
        return network;
    }
}